package com.health.mapper;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.health.entity.Consultingroom;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.health.entity.pojo.vo.ConsultingroomVO;
import org.apache.ibatis.annotations.Select;

import com.health.entity.Consultingroom;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.health.entity.pojo.vo.ConsultingroomVO;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;


import java.util.List;

/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author yuqingjiang
<<<<<<<<< Temporary merge branch 1
 * @since 2023-04-17
 */
public interface ConsultingroomMapper extends BaseMapper<Consultingroom> {

    //科室列表查询
    @Select("select id,name from consultingroom where parent_id = #{s}")
    Page<ConsultingroomVO> listAllConsultingrooms(IPage<ConsultingroomVO> page, Long s);

    //科室列表查询 重载
    @Select("select id,name from consultingroom where parent_id = #{s}")
    List<ConsultingroomVO> listAllConsultingrooms(Long s);

    //编辑科室中二级科室查询
    @Select("select id,name from consultingroom where parent_id = #{i}")
    List<ConsultingroomVO> getConsultingroomByName(Integer i);

    //下拉框科室查询
    @Select("select id,name from consultingroom where id = #{s}")
    Page<ConsultingroomVO> listSelectConsultingroom(IPage<ConsultingroomVO> page,Long s);



    @Select("select id,name from consultingroom where parent_id = #{s}")
    List<ConsultingroomVO> getConByParentId(Long s);


    @Update("update consultingroom set name where id = #{id}")
    Boolean updateConsultingroom(@Param("id") Integer id);

    @Select("select name from consultingroom where parent_id = '0'")
    List<String> getConsultingRoomsOne();

    @Select("select name from consultingroom where parent_id != '0'")
    List<String> getConsultingRoomsTwo();

    List<String> geOneConsultRooms();

}
